package com.lambda.plugin;

import com.android.build.gradle.AppExtension;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings("unused")
public class ASMPlugin implements Plugin<Project> {
    @Override
    public void apply(@NotNull Project project) {
        AppExtension extension = project.getExtensions().findByType(AppExtension.class);
        if (extension != null) {
            ASMConfig config = project.getExtensions().create("ASMConfig", ASMConfig.class);
            extension.registerTransform(new FastClickTransform(config));
        } else {
            throw new RuntimeException("AppExtension is null");
        }
    }
}
